Xbasic

SAMPLE_RECORDS Function

Syntax

Filter_Expression as C = sample_records(sample as n[,filter as c])

Arguments

sample

The interval between sampled records. Numeric

filter

Optional. Default = ".T." (All records). A character filter expression that evaluates to a logical value and selects records from the table. Character

Description

Select every Nth record in the table in the current sort order.

Discussion

SAMPLE_RECORDS() is a special function used only in queries to return Every Nth record in a table. If the optional filter is supplied, only the records selected by the filter are sampled.

Example

See Top, Bottom, Nth Record and Random Record Queries for more information. The following query returns every 10th order placed after May 1, 2000.

t = table.current()
query.filter = "sample_records(10, \"orderdate > {5/1/2000}\")"
query.order = "order_total"
i = t.query_create()
topparent.resynch()

See Also